/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements.  See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.rtx.ui.component.base;

import com.alee.laf.rootpane.WebFrame;
import im.rtx.base.service.ThemeService;
import im.rtx.ui.component.pannel.TitlePanel;

import javax.annotation.Resource;
import java.awt.*;

/**
 * Project  : rtx
 * Author   : solosky < solosky772@qq.com >
 * Created  : 2014/9/8
 * License  : Apache License 2.0
 */
public abstract class BaseFrame extends WebFrame {
    private TitlePanel titlePanel;
    @Resource
    private ThemeService themeService;


    protected TitlePanel getTitlePanel(){
        if(titlePanel == null){
            titlePanel = new TitlePanel(this);
        }
        return titlePanel;
    }

    protected ThemeService getThemeService(){
        return themeService;
    }

    protected void initFrame(){
        this.setUndecorated(true);
        this.setShowTitleComponent(false);
        this.setShowWindowButtons(false);
        this.setRound(0);
        this.add(getTitlePanel(), BorderLayout.NORTH);
        this.setIconImage(themeService.getImageIcon("base/window/titleWIcon").getImage());
    }
}
